Coding Help for soft Deleted Objects

I have a coding question related to history records for a soft deleted object across minor baselines?

Situation: There are times when developers soft delete objects. They can minor baseline the document as many times as they want, but this looses the delete object history. The modules are major baseline at major milestones.

I need to be able to look through the soft deleted objects, look at all of the object history back to the last major baseline, and see if it was deleted after the last major baseline. Suggestions?

The delete object operation does not change any of the system attributes except create a history record. (At least that is what I am able to tell.) I typed some pseudo thoughts below, but looking for an efficient and effective way to accomplish.

I am thinking:

for each object that is soft deleted
Check is to see if object creation date was earlier then last major baseline date.
If it was then loop through each minor baseline since the last major baseline for that object. Check if there is a "Delete Object" History record. Is so...do what I need to do.

Thanks
Chip
walkerln - Thu Nov 12 08:44:23 EST 2009

Re: Coding Help for soft Deleted Objects
doors36677 - Thu Nov 12 11:17:35 EST 2009

Question: What if same object has been undeleted and then re-deleted? Will this be fly in your ointment? You can see when last deleted by looking at "Last Modified On" Then look for baseline prior to that date.

Re: Coding Help for soft Deleted Objects
walkerln - Thu Nov 12 11:32:30 EST 2009

doors36677 - Thu Nov 12 11:17:35 EST 2009
Question: What if same object has been undeleted and then re-deleted? Will this be fly in your ointment? You can see when last deleted by looking at "Last Modified On" Then look for baseline prior to that date.

Two things.
1. That is a case I did not think of. In this case it is not a show stopper. The only purpose is to call attention to the object for the technical review panel. If this happened, the script would catch it, but then the history would show the deleted and undelete function.

2. As far as the "Last Modified On" This is not changed by the delete function.

Thanks
Chip

Re: Coding Help for soft Deleted Objects
walkerln - Thu Nov 12 14:39:18 EST 2009

walkerln - Thu Nov 12 11:32:30 EST 2009
Two things.
1. That is a case I did not think of. In this case it is not a show stopper. The only purpose is to call attention to the object for the technical review panel. If this happened, the script would catch it, but then the history would show the deleted and undelete function.

2. As far as the "Last Modified On" This is not changed by the delete function.

Thanks
Chip

Here the guts of it so far. Works for my need.
Object o, o_baseline, o1
int i, int1=0, int2=0, major_version=0
string str1, str2=""
Date d, d2
Baseline b
History hr
Skip absno1_baseline
HistoryType ht
Module m=current, m2
i=intOf(realOf(version m)) // gets number of last major baseline
str = (i) "." (0) "" // sets string to major baseline for baseline handle
filtering off
showDeletedObjects(true)

//***************************************************************
// Creats Skip List of object absolute values for quick looping
// Build a skip list which maps absnos onto their corresponding
// objects.
//
Skip getAbsnos(Module m) {
Skip res = create
Object o
for o in m do {
int a = o."Absolute Number"
put(res, a, o)
}
return res
}

// create filtered view of soft deleted objects
for o in m do
{
if (isDeleted(o))
{
accept o
} // end if

else
{
reject o
} // end else

} // end for

filtering on
refresh current Module

// If module has not been major baseline set date to null, if major baselined get major baseline date

if (str == "0.0")
d=null
else
{
for b in m do{
int1= major (b)
int2= minor (b)
str2= (int1) "." (int2) ""
if (str==str2)
{
major_version=int1
d= dateOf(b)
m2=load(b,false)
filtering off
showDeletedObjects(false)

}
}//end for loop

} //end else
if (d!=null) // only execute further filtering if module has been major baselined
{
for o in m do
{

d2= o."Created On"

if ( d2< d )
{
accept o
// print o."Absolute Number" " " o."Created On" " " d ""
} // end if

else
{
reject o
} // end else

} // end for

}//end if
refresh current Module
Skip absno1_current = getAbsnos m // build caches of absnos -> objects for current module
absno1_baseline = getAbsnos m2 // build caches of absnos -> objects for baseline
close (m2)
for o1 in absno1_current do{
Object o2
i = (int key absno1_current)
if (find(absno1_baseline, i, o2))
{
print "Found me! " i "\n"
} // end if
} // end for baseline loop